#include "StdAfx.h"
#include "ReaderController.h"
#include "function.h"

CReaderController::CReaderController(void)
{
}

CReaderController::~CReaderController(void)
{
}

HANDLE CReaderController::getHComHandle()
{
	return this->hComHandle;
}

void CReaderController::setHComHandle(HANDLE m_hComHandle)
{
	this->hComHandle = m_hComHandle;
}

int CReaderController::getBaudReate()
{
	return this->BaudRate;
}

void CReaderController::setBaudRate(int m_BaudRate)
{
	this->BaudRate = m_BaudRate;
}

void CReaderController::setCommPort(char* m_CommPort)
{
	this->CommPort = m_CommPort;
}

bool CReaderController::ReaderConnect(HANDLE* m_hCommHandle, char* m_CommPort)
{
	if( CommOpen( &(this->hComHandle), this->CommPort ) == 0 )
	{
		return true;
	}
	else
	{
		return false;
	}

}

bool CReaderController::ReaderDisconnect()
{
	if( CommClose(this->hComHandle) == 0 )
	{
		return true;
	}
	else
	{
		return false;
	}
}